package com.forlove.app.qselect.login.entity;

import com.forlove.app.common.base.mvp.entity.BaseEntity;
import com.forlove.app.qselect.login.widget.pickerview.model.IPickerViewData;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yjl on 2017/10/27.
 */

public class ProvinceEntity extends BaseEntity implements IPickerViewData {

    public DataInfoEntity province;
    public List<DataInfoEntity> cityEntities = new ArrayList<>();


    @Override
    public String getPickerViewText() {
        return province.name;
    }

    public DataInfoEntity getCity(int cityId) {
        DataInfoEntity mCity = null;
        for (int i = 0; i < cityEntities.size(); i++) {
            DataInfoEntity dataInfoEntity = cityEntities.get(i);
            if (dataInfoEntity.id == cityId) {
                mCity = dataInfoEntity;
                mCity.select = i;
                break;
            }
        }
        return mCity;
    }
}
